闘本 1.5 一発変換
提出
code: text
from collection import Counter
s1 = "pale"
s2 = "ple"
def can_change(s1, s2):
c1 = Counter(s1)
c2 = Counter(s2)
change = 0
for k, v in c1.items():
change += 1
if change >= 2:
return False
return True
実行結果
code: python
File "/Users/wafuwafu13/Desktop/CtCI-6th-Edition-Python/debug.py", line 1, in <module>
from collection import Counter
メモ
("pas", "pale", False) の場合 pas, pal までしか調べられていない